package com.cn.appcore.adapter;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import java.util.List;

/**
 * 项目：JingShortVideo
 * 包名：com.cn.jingshortvideo.ui.main.adapter
 * 类名：PagerAdapter
 * 创建时间：2022/9/2 17:45
 * 创建人 @author： xiaolin
 * 描述 ：Todo...
 */
public class PagerAdapter   extends FragmentStatePagerAdapter {

    private List<String> mList;
    private List<Fragment> mFragments;

    public PagerAdapter(FragmentManager fm, List<String> mList, List<Fragment> fragmentList) {
        super(fm);
        this.mList = mList;
        this.mFragments = fragmentList;
    }


    @Override
    public int getCount() {
        return mFragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {

        return mList.get(position);
    }

    @Override
    public Fragment getItem(int position) {
        if (position < mList.size()) {
            return mFragments.get(position);
        }
        return null;
    }
}


